/**util*/
define([],function (){
    return {
    	/**序列化表单的值成一个对象*/
        serializeObject:function(dom) {
			var o = {};
			var a = dom.serializeArray();
			$.each(a, function() {
				if (o[this.name] !== undefined) {
					if (!o[this.name].push) {
						o[this.name] = [ o[this.name] ];
					}
					o[this.name].push(this.value || '');
				} else {
					o[this.name] = this.value || '';
				}
			});
			return o;
		},
		/**地址栏获取参数*/
        GetQueryString:function (name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return unescape(r[2]); return null;
        },
		/**金额格式化*/
        Fmoney: function (s, n) {
            n = n > 0 && n <= 20 ? n : 2;
            s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + "";
            var l = s.split(".")[0].split("").reverse(),r = s.split(".")[1];
            var t = "";
            for (var i = 0; i < l.length; i++) {
                t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");
            }
            return t.split("").reverse().join("") + "." + r;
        },
        /**滚动位置*/
        scrollTop:function (number) {
            if($(document).scrollTop()!=0){
                if($('html,body').is(':animated')){
                    return false;
                }else{
                    $('html,body').animate({'scrollTop':number+'px'},1000);
                }
            }
        }
    };
})